<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>LiquidFun: b2IntrusiveList.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">LiquidFun
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_4ab6b4cc6a7edbff49100e9123df213f.html">Common</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">b2IntrusiveList.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">* Copyright (c) 2014 Google, Inc.</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">*</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">* This software is provided &#39;as-is&#39;, without any express or implied</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">* warranty.  In no event will the authors be held liable for any damages</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">* arising from the use of this software.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">* Permission is granted to anyone to use this software for any purpose,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">* including commercial applications, and to alter it and redistribute it</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">* freely, subject to the following restrictions:</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">* 1. The origin of this software must not be misrepresented; you must not</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">* claim that you wrote the original software. If you use this software</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">* in a product, an acknowledgment in the product documentation would be</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">* appreciated but is not required.</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">* 2. Altered source versions must be plainly marked as such, and must not be</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">* misrepresented as being the original software.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">* 3. This notice may not be removed or altered from any source distribution.</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#ifndef B2_INTRUSIVE_LIST</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define B2_INTRUSIVE_LIST</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="b2_settings_8h.html">Box2D/Common/b2Settings.h</a>&gt;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">// Whether to enable b2IntrusiveList::ValidateList().</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">// Be careful when enabling this since this changes the size of</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">// b2IntrusiveListNode so make sure *all* projects that include Box2D.h</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">// also define this value in the same way to avoid data corruption.</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#ifndef B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define B2_INTRUSIVE_LIST_VALIDATE 0</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif  // B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html">   64</a></span>&#160;<span class="keyword">class </span><a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a></div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;{</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#a6584f46e80ffd3dd8a9f1772197b8168">   68</a></span>&#160;    <a class="code" href="classb2_intrusive_list_node.html#a6584f46e80ffd3dd8a9f1772197b8168">b2IntrusiveListNode</a>()</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    {</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;        Initialize();</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="preprocessor">#if B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="preprocessor"></span>        m_magic = k_magic;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="preprocessor">#endif // B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="preprocessor"></span>    }</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#a6f66f51630fa5caa702ecea85f1ef8d4">   77</a></span>&#160;    <a class="code" href="classb2_intrusive_list_node.html#a6f66f51630fa5caa702ecea85f1ef8d4">~b2IntrusiveListNode</a>()</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    {</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;        <a class="code" href="classb2_intrusive_list_node.html#a1b5decaef6080b7a9c36a6eec957779a">Remove</a>();</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;<span class="preprocessor">#if B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="preprocessor"></span>        m_magic = 0;</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="preprocessor">#endif // B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="preprocessor"></span>    }</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;</div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#a39b12145a399a89f66953d114f7b4a52">   86</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classb2_intrusive_list_node.html#a39b12145a399a89f66953d114f7b4a52">InsertAfter</a>(<a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a>* <span class="keyword">const</span> node)</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    {</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        b2Assert(!node-&gt;<a class="code" href="classb2_intrusive_list_node.html#a2a824cfd5f79cd5dcedfc0dd96add8e2">InList</a>());</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        node-&gt;m_next = m_next;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        node-&gt;m_prev = <span class="keyword">this</span>;</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        m_next-&gt;m_prev = node;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        m_next = node;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    }</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#a8fb8d19c265f7dc1e9bccc0c3f7987e1">   96</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classb2_intrusive_list_node.html#a8fb8d19c265f7dc1e9bccc0c3f7987e1">InsertBefore</a>(<a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a>* <span class="keyword">const</span> node)</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    {</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        b2Assert(!node-&gt;<a class="code" href="classb2_intrusive_list_node.html#a2a824cfd5f79cd5dcedfc0dd96add8e2">InList</a>());</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        node-&gt;m_next = <span class="keyword">this</span>;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        node-&gt;m_prev = m_prev;</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        m_prev-&gt;m_next = node;</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        m_prev = node;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    }</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;</div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#ac889c92042c5aacac9637328aead4b2f">  106</a></span>&#160;    <span class="keyword">const</span> <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a>* <a class="code" href="classb2_intrusive_list_node.html#ac889c92042c5aacac9637328aead4b2f">GetTerminator</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">this</span>;</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    }</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#a1b5decaef6080b7a9c36a6eec957779a">  112</a></span>&#160;    <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a>* <a class="code" href="classb2_intrusive_list_node.html#a1b5decaef6080b7a9c36a6eec957779a">Remove</a>()</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    {</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;        m_prev-&gt;m_next = m_next;</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        m_next-&gt;m_prev = m_prev;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        Initialize();</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">this</span>;</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    }</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div>
<div class="line"><a name="l00121"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#a34b82d0f39896a0e9579116353f3d222">  121</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classb2_intrusive_list_node.html#a34b82d0f39896a0e9579116353f3d222">IsEmpty</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="classb2_intrusive_list_node.html#ab4b6d6ce35cc688a0a90d236d6ae971b">GetNext</a>() == <span class="keyword">this</span>;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    }</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;</div>
<div class="line"><a name="l00127"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#a2a824cfd5f79cd5dcedfc0dd96add8e2">  127</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classb2_intrusive_list_node.html#a2a824cfd5f79cd5dcedfc0dd96add8e2">InList</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;      <span class="keywordflow">return</span> !<a class="code" href="classb2_intrusive_list_node.html#a34b82d0f39896a0e9579116353f3d222">IsEmpty</a>();</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    }</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#a4cf61343c461e11e039dc2bce445179a">  133</a></span>&#160;    uint32 <a class="code" href="classb2_intrusive_list_node.html#a4cf61343c461e11e039dc2bce445179a">GetLength</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;        uint32 length = 0;</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;        <span class="keyword">const</span> <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a> * <span class="keyword">const</span> terminator = <a class="code" href="classb2_intrusive_list_node.html#ac889c92042c5aacac9637328aead4b2f">GetTerminator</a>();</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;        <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a>* node = <a class="code" href="classb2_intrusive_list_node.html#ab4b6d6ce35cc688a0a90d236d6ae971b">GetNext</a>();</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;             node != terminator; node = node-&gt;<a class="code" href="classb2_intrusive_list_node.html#ab4b6d6ce35cc688a0a90d236d6ae971b">GetNext</a>())</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        {</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;            length++;</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;        }</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        <span class="keywordflow">return</span> length;</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    }</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;</div>
<div class="line"><a name="l00146"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#ab4b6d6ce35cc688a0a90d236d6ae971b">  146</a></span>&#160;    <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a>* <a class="code" href="classb2_intrusive_list_node.html#ab4b6d6ce35cc688a0a90d236d6ae971b">GetNext</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;        <span class="keywordflow">return</span> m_next;</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    }</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;</div>
<div class="line"><a name="l00152"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#ac9ed793771f55613245044fa47f11c33">  152</a></span>&#160;    <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a>* <a class="code" href="classb2_intrusive_list_node.html#ac9ed793771f55613245044fa47f11c33">GetPrevious</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;        <span class="keywordflow">return</span> m_prev;</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;    }</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;</div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#a2040db2f03f83ee4420b4de502164880">  159</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classb2_intrusive_list_node.html#a2040db2f03f83ee4420b4de502164880">ValidateList</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;<span class="preprocessor">#if B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;<span class="preprocessor"></span>      <span class="keywordflow">if</span> (m_magic != k_magic) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;      <span class="keyword">const</span> <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a> * <span class="keyword">const</span> terminator = <a class="code" href="classb2_intrusive_list_node.html#ac889c92042c5aacac9637328aead4b2f">GetTerminator</a>();</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;      <span class="keywordflow">for</span> (<a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a> *node = <a class="code" href="classb2_intrusive_list_node.html#ab4b6d6ce35cc688a0a90d236d6ae971b">GetNext</a>(); node != terminator;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;           node = node-&gt;<a class="code" href="classb2_intrusive_list_node.html#ab4b6d6ce35cc688a0a90d236d6ae971b">GetNext</a>()) {</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        <span class="keywordflow">if</span> (node-&gt;m_magic != k_magic) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;      }</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;<span class="preprocessor">#endif  // B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;<span class="preprocessor"></span>      <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;    }</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;</div>
<div class="line"><a name="l00173"></a><span class="lineno"><a class="line" href="classb2_intrusive_list_node.html#a93688489ef91d2145e4df19e5a15f166">  173</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classb2_intrusive_list_node.html#a93688489ef91d2145e4df19e5a15f166">FindNodeInList</a>(<a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a>* <span class="keyword">const</span> nodeToFind)<span class="keyword"> const</span></div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;        <span class="keyword">const</span> <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a> * <span class="keyword">const</span> terminator = <a class="code" href="classb2_intrusive_list_node.html#ac889c92042c5aacac9637328aead4b2f">GetTerminator</a>();</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;        <span class="keywordflow">for</span> (<a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a> *node = <a class="code" href="classb2_intrusive_list_node.html#ab4b6d6ce35cc688a0a90d236d6ae971b">GetNext</a>(); node != terminator;</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;             node = node-&gt;<a class="code" href="classb2_intrusive_list_node.html#ab4b6d6ce35cc688a0a90d236d6ae971b">GetNext</a>())</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;        {</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;            <span class="keywordflow">if</span> (nodeToFind == node) <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;        }</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    }</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;    <span class="keywordtype">void</span> Initialize()</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;    {</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;        m_next = <span class="keyword">this</span>;</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;        m_prev = <span class="keyword">this</span>;</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    }</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;<span class="preprocessor">#if B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;<span class="preprocessor"></span>    uint32 m_magic;</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;<span class="preprocessor">#endif  // B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;<span class="preprocessor"></span>    <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a> *m_prev;</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a> *m_next;</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;<span class="preprocessor">#if B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;<span class="preprocessor"></span>    <span class="keyword">static</span> <span class="keyword">const</span> uint32 k_magic = 0x7157ac01;</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;<span class="preprocessor">#endif  // B2_INTRUSIVE_LIST_VALIDATE</span></div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;<span class="preprocessor"></span>};</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;<span class="preprocessor">#define B2_INTRUSIVE_LIST_GET_NODE(NodeMemberName) \</span></div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;<span class="preprocessor">    b2IntrusiveListNode* GetListNode() { return &amp;NodeMemberName; } \</span></div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;<span class="preprocessor">    const b2IntrusiveListNode* GetListNode() const { return &amp;NodeMemberName; }</span></div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;<span class="preprocessor">#define B2_INTRUSIVE_LIST_NODE_GET_CLASS_ACCESSOR( \</span></div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;<span class="preprocessor">    Class, NodeMemberName, FunctionName) \</span></div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;<span class="preprocessor">    static Class* FunctionName(b2IntrusiveListNode *node) \</span></div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;<span class="preprocessor">    { \</span></div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;<span class="preprocessor">        Class *cls = NULL; \</span></div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;<span class="preprocessor">        </span><span class="comment">/* This effectively performs offsetof(Class, NodeMemberName) */</span><span class="preprocessor"> \</span></div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;<span class="preprocessor">        </span><span class="comment">/* which ends up in the undefined behavior realm of C++ but in */</span><span class="preprocessor"> \</span></div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;<span class="preprocessor">        </span><span class="comment">/* practice this works with most compilers. */</span><span class="preprocessor"> \</span></div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;<span class="preprocessor">        return reinterpret_cast&lt;Class*&gt;((uint8*)(node) - \</span></div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;<span class="preprocessor">                                        (uint8*)(&amp;cls-&gt;NodeMemberName)); \</span></div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;<span class="preprocessor">    } \</span></div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;<span class="preprocessor">    \</span></div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;<span class="preprocessor">    static const Class* FunctionName(const b2IntrusiveListNode *node) \</span></div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;<span class="preprocessor">    { \</span></div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;<span class="preprocessor">        return FunctionName(const_cast&lt;b2IntrusiveListNode*&gt;(node)); \</span></div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;<span class="preprocessor">    }</span></div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;<span class="preprocessor">#define B2_INTRUSIVE_LIST_NODE_GET_CLASS(Class, NodeMemberName) \</span></div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;<span class="preprocessor">    B2_INTRUSIVE_LIST_NODE_GET_CLASS_ACCESSOR(Class, NodeMemberName, \</span></div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;<span class="preprocessor">                                              GetInstanceFromListNode)</span></div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00272"></a><span class="lineno"><a class="line" href="classb2_typed_intrusive_list_node.html">  272</a></span>&#160;<span class="keyword">class </span><a class="code" href="classb2_typed_intrusive_list_node.html">b2TypedIntrusiveListNode</a></div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;{</div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;    <a class="code" href="classb2_typed_intrusive_list_node.html">b2TypedIntrusiveListNode</a>() { }</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;    ~<a class="code" href="classb2_typed_intrusive_list_node.html">b2TypedIntrusiveListNode</a>() { }</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;</div>
<div class="line"><a name="l00279"></a><span class="lineno"><a class="line" href="classb2_typed_intrusive_list_node.html#a6894d739328baee8a9fdf2ec9988faeb">  279</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classb2_typed_intrusive_list_node.html#a6894d739328baee8a9fdf2ec9988faeb">InsertAfter</a>(T* <span class="keyword">const</span> obj)</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;    {</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;        b2Assert(obj);</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;        GetListNode()-&gt;InsertAfter(obj-&gt;GetListNode());</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;    }</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;</div>
<div class="line"><a name="l00286"></a><span class="lineno"><a class="line" href="classb2_typed_intrusive_list_node.html#a9f0d0fcf2f8c5b26938364a5ff2d97ed">  286</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classb2_typed_intrusive_list_node.html#a9f0d0fcf2f8c5b26938364a5ff2d97ed">InsertBefore</a>(T* <span class="keyword">const</span> obj)</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;    {</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;        b2Assert(obj);</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;        GetListNode()-&gt;InsertBefore(obj-&gt;GetListNode());</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;    }</div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;</div>
<div class="line"><a name="l00294"></a><span class="lineno"><a class="line" href="classb2_typed_intrusive_list_node.html#aae40a37f35d5a8e3133aac16dc16fb3c">  294</a></span>&#160;    T* <a class="code" href="classb2_typed_intrusive_list_node.html#aae40a37f35d5a8e3133aac16dc16fb3c">GetNext</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="classb2_typed_intrusive_list_node.html#ad8f01da7dc1d8d7743d5051b262c277b">GetInstanceFromListNode</a>(GetListNode()-&gt;<a class="code" href="classb2_typed_intrusive_list_node.html#aae40a37f35d5a8e3133aac16dc16fb3c">GetNext</a>());</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;    }</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;</div>
<div class="line"><a name="l00301"></a><span class="lineno"><a class="line" href="classb2_typed_intrusive_list_node.html#abaf87f46201673c6920f2e5d761de9a4">  301</a></span>&#160;    T* <a class="code" href="classb2_typed_intrusive_list_node.html#abaf87f46201673c6920f2e5d761de9a4">GetPrevious</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="classb2_typed_intrusive_list_node.html#ad8f01da7dc1d8d7743d5051b262c277b">GetInstanceFromListNode</a>(GetListNode()-&gt;<a class="code" href="classb2_typed_intrusive_list_node.html#abaf87f46201673c6920f2e5d761de9a4">GetPrevious</a>());</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;    }</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;</div>
<div class="line"><a name="l00309"></a><span class="lineno"><a class="line" href="classb2_typed_intrusive_list_node.html#ae526e3967c69e9c928e645b368481a4a">  309</a></span>&#160;    T* <a class="code" href="classb2_typed_intrusive_list_node.html#ae526e3967c69e9c928e645b368481a4a">GetTerminator</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;        <span class="keywordflow">return</span> (T*)GetListNode();</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;    }</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;</div>
<div class="line"><a name="l00315"></a><span class="lineno"><a class="line" href="classb2_typed_intrusive_list_node.html#adc1d7a9e50bfe8e92f3d01fafd66aa67">  315</a></span>&#160;    T* <a class="code" href="classb2_typed_intrusive_list_node.html#adc1d7a9e50bfe8e92f3d01fafd66aa67">Remove</a>()</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;    {</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;        GetListNode()-&gt;<a class="code" href="classb2_typed_intrusive_list_node.html#adc1d7a9e50bfe8e92f3d01fafd66aa67">Remove</a>();</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="classb2_typed_intrusive_list_node.html#ad8f01da7dc1d8d7743d5051b262c277b">GetInstanceFromListNode</a>(GetListNode());</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;    }</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;</div>
<div class="line"><a name="l00322"></a><span class="lineno"><a class="line" href="classb2_typed_intrusive_list_node.html#a3b1aabcab79d482b99a5a967442dc342">  322</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classb2_typed_intrusive_list_node.html#a3b1aabcab79d482b99a5a967442dc342">InList</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;        <span class="keywordflow">return</span> GetListNode()-&gt;InList();</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;    }</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    <span class="comment">// Determine whether this list is empty.</span></div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;    <span class="keywordtype">bool</span> IsEmpty()<span class="keyword"> const</span></div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;        <span class="keywordflow">return</span> GetListNode()-&gt;IsEmpty();</div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;    }</div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;</div>
<div class="line"><a name="l00334"></a><span class="lineno"><a class="line" href="classb2_typed_intrusive_list_node.html#a8e73f61571429c7381b7462b1b6153fa">  334</a></span>&#160;    uint32 <a class="code" href="classb2_typed_intrusive_list_node.html#a8e73f61571429c7381b7462b1b6153fa">GetLength</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;        <span class="keywordflow">return</span> GetListNode()-&gt;GetLength();</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    }</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;    B2_INTRUSIVE_LIST_GET_NODE(m_node);</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;    <span class="comment">// Node within an intrusive list.</span></div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;    <a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a> m_node;</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;</div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00347"></a><span class="lineno"><a class="line" href="classb2_typed_intrusive_list_node.html#ad8f01da7dc1d8d7743d5051b262c277b">  347</a></span>&#160;    <span class="keyword">static</span> T* <a class="code" href="classb2_typed_intrusive_list_node.html#ad8f01da7dc1d8d7743d5051b262c277b">GetInstanceFromListNode</a>(<a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a>* <span class="keyword">const</span> node)</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;    {</div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;        b2Assert(node);</div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;        <span class="comment">// Calculate the pointer to T from the offset.</span></div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;        <span class="keywordflow">return</span> (T*)((uint8*)node - GetNodeOffset(node));</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;    }</div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;    <span class="comment">// Get the offset of m_node within this class.</span></div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;    <span class="keyword">static</span> int32 GetNodeOffset(<a class="code" href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a>* <span class="keyword">const</span> node)</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;    {</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;        b2Assert(node);</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;        <span class="comment">// Perform some type punning to calculate the offset of m_node in T.</span></div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;        <span class="comment">// WARNING: This could result in undefined behavior with some C++</span></div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;        <span class="comment">// compilers.</span></div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;        T* obj = (T*)node;</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;        int32 nodeOffset = (int32)((uint8*)&amp;obj-&gt;m_node - (uint8*)obj);</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;        <span class="keywordflow">return</span> nodeOffset;</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;    }</div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;};</div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;<span class="preprocessor">#endif // B2_INTRUSIVE_LIST</span></div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;<span class="preprocessor"></span></div>
<div class="ttc" id="classb2_typed_intrusive_list_node_html_abaf87f46201673c6920f2e5d761de9a4"><div class="ttname"><a href="classb2_typed_intrusive_list_node.html#abaf87f46201673c6920f2e5d761de9a4">b2TypedIntrusiveListNode::GetPrevious</a></div><div class="ttdeci">T * GetPrevious() const </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:301</div></div>
<div class="ttc" id="classb2_typed_intrusive_list_node_html_ad8f01da7dc1d8d7743d5051b262c277b"><div class="ttname"><a href="classb2_typed_intrusive_list_node.html#ad8f01da7dc1d8d7743d5051b262c277b">b2TypedIntrusiveListNode::GetInstanceFromListNode</a></div><div class="ttdeci">static T * GetInstanceFromListNode(b2IntrusiveListNode *const node)</div><div class="ttdoc">Get a pointer to the instance of T that contains &quot;node&quot;. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:347</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_a2040db2f03f83ee4420b4de502164880"><div class="ttname"><a href="classb2_intrusive_list_node.html#a2040db2f03f83ee4420b4de502164880">b2IntrusiveListNode::ValidateList</a></div><div class="ttdeci">bool ValidateList() const </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:159</div></div>
<div class="ttc" id="classb2_typed_intrusive_list_node_html_a8e73f61571429c7381b7462b1b6153fa"><div class="ttname"><a href="classb2_typed_intrusive_list_node.html#a8e73f61571429c7381b7462b1b6153fa">b2TypedIntrusiveListNode::GetLength</a></div><div class="ttdeci">uint32 GetLength() const </div><div class="ttdoc">Calculate the length of the list. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:334</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_a6584f46e80ffd3dd8a9f1772197b8168"><div class="ttname"><a href="classb2_intrusive_list_node.html#a6584f46e80ffd3dd8a9f1772197b8168">b2IntrusiveListNode::b2IntrusiveListNode</a></div><div class="ttdeci">b2IntrusiveListNode()</div><div class="ttdoc">Initialize the node. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:68</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_a1b5decaef6080b7a9c36a6eec957779a"><div class="ttname"><a href="classb2_intrusive_list_node.html#a1b5decaef6080b7a9c36a6eec957779a">b2IntrusiveListNode::Remove</a></div><div class="ttdeci">b2IntrusiveListNode * Remove()</div><div class="ttdoc">Remove this node from the list it&#39;s currently in. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:112</div></div>
<div class="ttc" id="classb2_typed_intrusive_list_node_html_a3b1aabcab79d482b99a5a967442dc342"><div class="ttname"><a href="classb2_typed_intrusive_list_node.html#a3b1aabcab79d482b99a5a967442dc342">b2TypedIntrusiveListNode::InList</a></div><div class="ttdeci">bool InList() const </div><div class="ttdoc">Determine whether this object is in a list. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:322</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html"><div class="ttname"><a href="classb2_intrusive_list_node.html">b2IntrusiveListNode</a></div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:64</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_ac9ed793771f55613245044fa47f11c33"><div class="ttname"><a href="classb2_intrusive_list_node.html#ac9ed793771f55613245044fa47f11c33">b2IntrusiveListNode::GetPrevious</a></div><div class="ttdeci">b2IntrusiveListNode * GetPrevious() const </div><div class="ttdoc">Get the previous node in the list. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:152</div></div>
<div class="ttc" id="classb2_typed_intrusive_list_node_html_aae40a37f35d5a8e3133aac16dc16fb3c"><div class="ttname"><a href="classb2_typed_intrusive_list_node.html#aae40a37f35d5a8e3133aac16dc16fb3c">b2TypedIntrusiveListNode::GetNext</a></div><div class="ttdeci">T * GetNext() const </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:294</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_a4cf61343c461e11e039dc2bce445179a"><div class="ttname"><a href="classb2_intrusive_list_node.html#a4cf61343c461e11e039dc2bce445179a">b2IntrusiveListNode::GetLength</a></div><div class="ttdeci">uint32 GetLength() const </div><div class="ttdoc">Calculate the length of the list. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:133</div></div>
<div class="ttc" id="classb2_typed_intrusive_list_node_html_a6894d739328baee8a9fdf2ec9988faeb"><div class="ttname"><a href="classb2_typed_intrusive_list_node.html#a6894d739328baee8a9fdf2ec9988faeb">b2TypedIntrusiveListNode::InsertAfter</a></div><div class="ttdeci">void InsertAfter(T *const obj)</div><div class="ttdoc">Insert this object after the specified object. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:279</div></div>
<div class="ttc" id="classb2_typed_intrusive_list_node_html"><div class="ttname"><a href="classb2_typed_intrusive_list_node.html">b2TypedIntrusiveListNode</a></div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:272</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_a93688489ef91d2145e4df19e5a15f166"><div class="ttname"><a href="classb2_intrusive_list_node.html#a93688489ef91d2145e4df19e5a15f166">b2IntrusiveListNode::FindNodeInList</a></div><div class="ttdeci">bool FindNodeInList(b2IntrusiveListNode *const nodeToFind) const </div><div class="ttdoc">Determine whether the specified node is present in this list. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:173</div></div>
<div class="ttc" id="classb2_typed_intrusive_list_node_html_adc1d7a9e50bfe8e92f3d01fafd66aa67"><div class="ttname"><a href="classb2_typed_intrusive_list_node.html#adc1d7a9e50bfe8e92f3d01fafd66aa67">b2TypedIntrusiveListNode::Remove</a></div><div class="ttdeci">T * Remove()</div><div class="ttdoc">Remove this object from the list it&#39;s currently in. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:315</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_ab4b6d6ce35cc688a0a90d236d6ae971b"><div class="ttname"><a href="classb2_intrusive_list_node.html#ab4b6d6ce35cc688a0a90d236d6ae971b">b2IntrusiveListNode::GetNext</a></div><div class="ttdeci">b2IntrusiveListNode * GetNext() const </div><div class="ttdoc">Get the next node in the list. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:146</div></div>
<div class="ttc" id="classb2_typed_intrusive_list_node_html_a9f0d0fcf2f8c5b26938364a5ff2d97ed"><div class="ttname"><a href="classb2_typed_intrusive_list_node.html#a9f0d0fcf2f8c5b26938364a5ff2d97ed">b2TypedIntrusiveListNode::InsertBefore</a></div><div class="ttdeci">void InsertBefore(T *const obj)</div><div class="ttdoc">Insert this object before the specified object. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:286</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_a2a824cfd5f79cd5dcedfc0dd96add8e2"><div class="ttname"><a href="classb2_intrusive_list_node.html#a2a824cfd5f79cd5dcedfc0dd96add8e2">b2IntrusiveListNode::InList</a></div><div class="ttdeci">bool InList() const </div><div class="ttdoc">Determine whether this node is in a list or the list contains nodes. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:127</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_a34b82d0f39896a0e9579116353f3d222"><div class="ttname"><a href="classb2_intrusive_list_node.html#a34b82d0f39896a0e9579116353f3d222">b2IntrusiveListNode::IsEmpty</a></div><div class="ttdeci">bool IsEmpty() const </div><div class="ttdoc">Determine whether this list is empty or the node isn&#39;t in a list. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:121</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_a8fb8d19c265f7dc1e9bccc0c3f7987e1"><div class="ttname"><a href="classb2_intrusive_list_node.html#a8fb8d19c265f7dc1e9bccc0c3f7987e1">b2IntrusiveListNode::InsertBefore</a></div><div class="ttdeci">void InsertBefore(b2IntrusiveListNode *const node)</div><div class="ttdoc">Insert this node before the specified node. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:96</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_ac889c92042c5aacac9637328aead4b2f"><div class="ttname"><a href="classb2_intrusive_list_node.html#ac889c92042c5aacac9637328aead4b2f">b2IntrusiveListNode::GetTerminator</a></div><div class="ttdeci">const b2IntrusiveListNode * GetTerminator() const </div><div class="ttdoc">Get the terminator of the list. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:106</div></div>
<div class="ttc" id="b2_settings_8h_html"><div class="ttname"><a href="b2_settings_8h.html">b2Settings.h</a></div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_a6f66f51630fa5caa702ecea85f1ef8d4"><div class="ttname"><a href="classb2_intrusive_list_node.html#a6f66f51630fa5caa702ecea85f1ef8d4">b2IntrusiveListNode::~b2IntrusiveListNode</a></div><div class="ttdeci">~b2IntrusiveListNode()</div><div class="ttdoc">If the node is in a list, remove it from the list. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:77</div></div>
<div class="ttc" id="classb2_typed_intrusive_list_node_html_ae526e3967c69e9c928e645b368481a4a"><div class="ttname"><a href="classb2_typed_intrusive_list_node.html#ae526e3967c69e9c928e645b368481a4a">b2TypedIntrusiveListNode::GetTerminator</a></div><div class="ttdeci">T * GetTerminator() const </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:309</div></div>
<div class="ttc" id="classb2_intrusive_list_node_html_a39b12145a399a89f66953d114f7b4a52"><div class="ttname"><a href="classb2_intrusive_list_node.html#a39b12145a399a89f66953d114f7b4a52">b2IntrusiveListNode::InsertAfter</a></div><div class="ttdeci">void InsertAfter(b2IntrusiveListNode *const node)</div><div class="ttdoc">Insert this node after the specified node. </div><div class="ttdef"><b>Definition:</b> b2IntrusiveList.h:86</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-46159502-1', 'auto');
ga('create', 'UA-49880327-7', 'auto', {'name': 'liquidFunTracker'});
ga('send', 'pageview');
ga('liquidFunTracker.send', 'pageview');
</script>
</body>
</html>
